package com.clarence.dada.config.mybatis;


import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.clarence.dada.core.base.CustomInsertBatchSqlInjector;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MybatisPlus配置文件
 *
 * @author GD
 * @since 2020-07-30 10:36
 */
@Configuration
@MapperScan("com.clarence.dada.**.mapper")
public class MybatisPlusConfig {
    /**
     * mybatis-plus分页插件
     *
     * @return PaginationInterceptor
     * @author GD
     * @since 2020-07-30 10:36
     */
    @Bean
    public MybatisPlusInterceptor paginationInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

    @Bean
    public CustomInsertBatchSqlInjector customInsertBatchSqlInjector() {
        return new CustomInsertBatchSqlInjector();
    }

}